//TicketClerk.h
#ifndef TicketClerk_H
#define TicketClerk_H

#include "line.h"
#include "list.h"
#include "synch.h"
#include <stdarg.h>
#include <string>


enum TicketClerkStates {Idle, WaitingForCust, WaitingForPay, TalkingToManager, OnBreak};

class TicketClerk
{
	public:
		TicketClerk(char* name, Line* line);
		~TicketClerk();
		void SendMessage(char* name, int argc, ...);
		void SendMessage(char* name, IterList* args);
		void Scheduler();
		void TicketClerk::CT3();
		void TicketClerk::CT4();
		void Start();
		
		MsgList* msgList;
		void* replyTo;
		Lock* msgLock;
		Thread* myThread;
		char* myName;
		Condition* sleepCon;
			int lineLength;
		int msgInt;
		
		Line* myLine;
		float* moneyCollected;
		float money;
		bool onBreak;
		int groupSize;
		//Possible statuses for TicketClerk: {Idle, WaitingForCust, WaitingForPay, TalkingToManager, OnBreak}
		std::string status;
		float TICKET_PRICE;
		
		
		bool CallNextInLine();
		void AskForPayment(void* custPtr, int size);
		void GiveTickets(void* custPtr, float payment);
		void GiveManagerMoney(void* mngrPtr);
		void TellStatus(void* mngrPtr);
		void ContinueOn();
		void GoOnBreak();
		void ComeOffBreak();
		
};


#endif
